package com.flqy.baselibrary;

import android.content.Context;
import androidx.multidex.MultiDex;
import androidx.multidex.MultiDexApplication;

import com.flqy.baselibrary.utils.ScreenUtil;
import com.flqy.baselibrary.utils.Utils;

import java.io.File;

public abstract class BaseApp extends MultiDexApplication {
    private static BaseApp mInstance;
    private Session mSession;
    private static final String DOWNLOAD_DIR_NAME = "common_cache";
    private static final String UPLOAD_DIR_NAME = "upload_dir";

    public static BaseApp getInstance() {
        return mInstance;
    }

    @Override
    public void onCreate() {
        super.onCreate();
        mInstance = this;
        ScreenUtil.init(this);
        mSession = new Session(this);
    }
    @Override
    protected void attachBaseContext(Context base) {
        super.attachBaseContext(base);
        MultiDex.install(base);
    }
    public File getUploadCacheDir() {
        return Utils.getExistCacheDir(this,UPLOAD_DIR_NAME);

    }

    public File getDownloadCacheDir() {
        return Utils.getExistCacheDir(this,DOWNLOAD_DIR_NAME);
    }

    public Session getSession() {
        return mSession;
    }


    public abstract IUser getUser();

    public abstract boolean isDebug();
}
